package com.sixth.service.Impl;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sixth.dao.CourseCheckDao;
import com.sixth.entity.Course;
import com.sixth.entity.CourseCheck;
import com.sixth.service.CourseCheckServicer;
import com.sixth.until.CommonResult;
import com.sixth.until.TableResult;
import com.sixth.until.WebUtil;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @program: self-tui-education
 * @description:
 * @author: 老魏
 * @create: 2022-04-21 23:08
 **/
@Service
public class CourseCheckServicerImpl implements CourseCheckServicer {
    @Autowired
    private CourseCheckDao courseCheckDao;
    @Override
    public TableResult findCourseCheck(Integer pageCurrent, Integer pageSize, Course course) {
        PageHelper.startPage(pageCurrent,pageSize);
        List<CourseCheck> list = courseCheckDao.findCourseCheck(course.getTitle(),course.getStatus());
        PageInfo<CourseCheck> pageInfo = new PageInfo<>(list);
        return new TableResult(2000,"查询成功",pageInfo.getTotal(),pageInfo.getList());
    }

    @Override
    public CommonResult updateCourseCheck(CourseCheck courseCheck) {
        int row=courseCheckDao.updateCheck(courseCheck.getCourseId(),courseCheck.getCheckStatus(),courseCheck.getCheckContent());
        return new CommonResult(2000,"审核成功",null);
    }


}
